/* eslint valid-jsdoc: "off" */

'use strict';
const path = require("path")
const fs = require("fs")

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = exports = {};

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1633401062527_3702';

    // add your middleware config here
    config.middleware = [];

    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
    };
    config.jwt = {
        secret: "111111"
    }
    config.sequelize = {
        dialect: "mysql", //数据库类型
        database: "cms", //数据库名称
        host: "localhost", //主机
        port: 3306, //端口
        username: 'root', //用户名
        password: "111111", //密码
        timezone: "+08:00" //时区
    }
    config.view = {
        defaultViewEngine: "nunjucks",
    }

    config.cors = {
        origin: "*", //允许所有跨域访问
        credentials: true, //允许跨域请求携带cookie
        allowMethods: "GET,POST,HEAD,PUT,DELETE,PATCH"
    }
    config.security = {
        csrf: {
            enable: false
        }
    }
    config.multipart = {
            fieldSize: "(300 * 1000 * 1000)mb" //设置上传限制为300M
        }
        //设置静态文件目录
    config.static = {
        prefix: '/', //访问路径
        dir: path.join(appInfo.baseDir, 'app/public'), //设置静态文件目录
    };
    return {
        ...config,
        ...userConfig,
    };
};